package com.ddwang.dockerrun.controller;

import com.ddwang.dockerrun.entity.SqlConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConfigurationController {
    @Autowired
    public SqlConfig sqlConfig;
    @Value("${myconfig.sqlconfig.hostPath}")
    public String hostpath;
    @Value("${sysvariable.java-home}")
    public String javaHome;
    @Value("${sysvariable.temp}")
    public String temp;
    @Value("${sysvariable.os:#{null}}")
//    这里设置默认系统类别，如果配置文件没有，从系统变量中获取
    public String os;

    @RequestMapping("/temp")
    public String temp(){
        return temp;
    }
    @RequestMapping("/os")
    public String os(){
        return os;
    }
    @RequestMapping("/javahome")
    public String javahome(){
        return javaHome;
    }
    @RequestMapping("/hostpath")
    public String hostpath(){
        return hostpath;
    }
    @RequestMapping("/pro")
    public String properties(){
        return sqlConfig.toString();
    }
}
